package com.projectmanagement.model.data;

import java.io.Serializable;
import java.sql.Timestamp;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name="Sent_Messages")
public class SentMessage implements Serializable{

	private static final long serialVersionUID = -7282425061798332839L;

	@Id
	@Column(name="id")
	@GeneratedValue
	private long id;
	
	@ManyToOne(cascade=CascadeType.ALL, fetch = FetchType.LAZY)
	private Message message;
	
	@Column(name="created_on", nullable = false)
	private Timestamp createdOn = new Timestamp(0);
	
	public SentMessage() {
	}

	public SentMessage(Message message){
		this();
		this.createdOn = new Timestamp(System.currentTimeMillis());
		this.message = message;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public Message getMessage() {
		return message;
	}

	public void setMessage(Message message) {
		this.message = message;
	}

	public Timestamp getCreatedOn() {
		return createdOn;
	}

	public void setCreatedOn(Timestamp createdOn) {
		this.createdOn = createdOn;
	}
	
}
